package com.imooc.imoocbilibili.controller;

import com.imooc.imoocbilibili.entity.UserMoments;
import com.imooc.imoocbilibili.service.UserMomentsService;
import com.imooc.imoocbilibili.utils.R;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;


/**
 * 用户动态表
 *
 * @author jl
 * @since 2022-04-10 21:13:43
 */
@RestController
@RequiredArgsConstructor
public class UserMomentsController {

    private final UserMomentsService userMomentsService;

    /**
     * 新增用户动态
     */
    @PostMapping("/user-moments")
    public R addUserMoments(@RequestBody UserMoments userMoments) {
        userMomentsService.addUserMoments(userMoments);
        return R.ok();
    }

    /**
     * 查询用户动态
     */
    @GetMapping("/user-moments")
    public R getUserMoments() {
        return R.ok(userMomentsService.getUserMoments());
    }


}
